
$(document).ready(function() {
    $("#agenda tbody tr").click(function() {
       
    	 var cible = $(this).children('td');
         var descrip = $(cible).children('div').text();
         var id_tache = $(cible).children("p[id^='id_tache']").text();
         var id_demande = $(cible).children("p[id^='id_demande']").text();
         
        // alert(id_demande);
    	  
    	 //$( "#dialog" ).dialog();
         $( "#content" ).html(descrip);
    	$( "#dialog" ).dialog({
    	    modal: false,
    	    autoOpen: true,
    	    width: 400,
    	    height: 300,
    	    buttons: {
    	      "Valider": function() {
    	       // $('body').css('background', 'yellow');
    	    	  
    	    	  $.ajax({
    	    	       url : '/lamisa.burundi/public/application/intranet/updateagenda',
    	    	       type : 'POST', 
    	    	       data : 'reponse=' + 1 +'&id_tache='+parseInt(id_tache)+'&id_demande='+parseInt(id_demande),
    	    	    }).done(function() {
    	    	    	window.location.href = window.location.href;
    	    	    })
    	    	 
    	    	    $( this ).dialog( "close" );
    	     
    	      },
    	      	"Ajourner": function() {
    	    	  
    	    	  $.ajax({
   	    	       url : '/lamisa.burundi/public/application/intranet/updateagenda',
   	    	       type : 'POST', 
   	    	       data : 'reponse=' + -1 +'&id_tache='+parseInt(id_tache)+'&id_demande='+parseInt(id_demande),
   	    	    }).done(function() {
	    	    	window.location.href = window.location.href;
	    	    })
    	        $( this ).dialog( "close" );
    	      },
    	      "Refuser": function() {
    	    	  
    	    	  $.ajax({
   	    	       url : '/lamisa.burundi/public/application/intranet/updateagenda',
   	    	       type : 'POST', 
   	    	       data : 'reponse=' + 0 +'&id_tache='+parseInt(id_tache)+'&id_demande='+parseInt(id_demande),
   	    	    }).done(function() {
	    	    	window.location.href = window.location.href;
	    	    })
    	        $( this ).dialog( "close" );
    	      }
    	    }
    	  });	   
    	  // location.reload();
	       // window.location.reload();
	       //window.location.href = window.location.href;
    	
    });
    

    $("#mois_").change( function() { 
    	
    	//alert("Ok");
    	var mois =$( "#mois_ option:selected" ).text();
    	
    	 $("#mois_t").html(mois);
    	 $( "#datepicker2" ).datepicker( "setDate", "10/12/2012" );
    } );
    
    
    
    
});



